package com.ce.pms.common.web;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.ce.pms.base.web.PmsBaseAction;
import com.ce.pms.common.service.IComLog4ceBizLogInfoService;
import com.ce.pms.common.vo.ComLog4ceBizLogInfoVO;
import com.ce.util.BeanUtil;
import com.sitechasia.webx.components.xtable.util.ExtremeUtils;
import com.sitechasia.webx.core.annotation.Read;
import com.sitechasia.webx.core.support.Page;

public class ComLog4ceBizLogInfoAction extends PmsBaseAction {

	private IComLog4ceBizLogInfoService comLog4ceBizLogInfoService = null;


	/**
	 * 功能描述:  初始化主页面<br>
	 * @return
	 * Create author:gaosong <br>
	 * Create on:2008-9-12  <br>
	 */
	public String initMain(){
		initCache();//缓存操作类型下拉列表
		return "main";
	}

	/**
	 * 功能描述:  初始化列表页面<br>
	 * @return
	 * Create author:gaosong <br>
	 * Create on:2008-9-12  <br>
	 */
	public String initList(){
		setAttribute("totalRows", Integer.valueOf(0));
		return "list";
	}


	/**
	 * 功能描述:  加载主页面时,缓存操作类型下拉列表<br>
	 * Create author:gaosong <br>
	 * Create on:2008-9-16  <br>
	 */
	private void initCache(){
		//缓存楼栋列表
		List<ComLog4ceBizLogInfoVO> log4ceinfoList = comLog4ceBizLogInfoService.readProperties();
		this.getRequest().setAttribute("comLog4ceBizLogInfoList", log4ceinfoList);
	}

	/**
	 * 功能描述:  查询日志信息列表
	 * @param comLog4ceBizLogInfoVO
	 * @return
	 * Create author:gaosong
	 * Create on:2008-10-7
	 */
	public String ComLog4ceBizLogList(@Read ComLog4ceBizLogInfoVO comLog4ceBizLogInfoVO,
						 @Read(key="ec_p", defaultValue="1") int pageNo,
			             @Read(key="ec_crd",defaultValue="15")int pageSize){
		String orderStr = ExtremeUtils.getOrderString(getRequest());
		comLog4ceBizLogInfoVO.setSortStr(orderStr);
		comLog4ceBizLogInfoVO.setPageNo(pageNo);
		comLog4ceBizLogInfoVO.setPageSize(pageSize);

		Page page = comLog4ceBizLogInfoService.queryComLog4ceBizLogInfo(comLog4ceBizLogInfoVO);

		setAttribute("comLog4ceBizLogInfoList", page.getResult());
		Long totalRow=page.getTotalCount();
		setAttribute("totalRows", new Integer(totalRow.intValue()));
		return "list";
	}


	/**
	 * @return the comLog4ceBizLogInfoService
	 */
	public IComLog4ceBizLogInfoService getComLog4ceBizLogInfoService() {
		return comLog4ceBizLogInfoService;
	}


	/**
	 * @param comLog4ceBizLogInfoService the comLog4ceBizLogInfoService to set
	 */
	public void setComLog4ceBizLogInfoService(
			IComLog4ceBizLogInfoService comLog4ceBizLogInfoService) {
		this.comLog4ceBizLogInfoService = comLog4ceBizLogInfoService;
	}
}